﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common;
using Common.Service;
using MessageBusConn;

namespace MessageBus.Controllers
{
    public class HomeController : Controller
    {
        private BLL bll = new BLL();
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Edit(string id)
        {
            ViewBag.id = id;
            return View();
        }

        public JsonResult List()
        {
            var list = bll.List();
            return Json(list);
        }

        public JsonResult Get(string id)
        {
            var model = bll.Get(id);
            return Json(model);
        }
        public JsonResult Save(tbcontrol model)
        {
            var success = bll.Save(model);
            if (success)
                BusHelper.Bind();
            return Json(new { success });
        }
    }
}